//
//  DiscoverPageTool.m
//  MindBox
//
//  Created by MS on 16-1-6.
//  Copyright (c) 2016年 Lemon. All rights reserved.
//

#import "DiscoverPageTool.h"
#import "LGHttpTool.h"
#import "MJExtension.h"
#import "INTERFACE.h"
@implementation DiscoverPageTool

+ (void)discoverWelfareDataWithSuccess:(void (^)( Discover_Welfare * data))success
                               failure:(void (^)( NSError *error))failure
{
    [LGHttpTool GET:Discover_Welfare_URL parameters:nil success:^(id responseObject) {
        
        Discover_Welfare_Model * welfare = [Discover_Welfare_Model mj_objectWithKeyValues:responseObject];
        Discover_Welfare * data = welfare.data;
        
        if (success) {
            
            success(data);
        }
        
    } failure:^(NSError *error) {
        if (failure) {
            failure(error);
        }
    }];
    
}

+ (void)discoverMindDataWithPages:(int)pages Success:(void (^)( Discover_Mind * data))success failure:(void (^)( NSError *error))failure
{
    NSString * url = Discover_Mind_URL(pages);
    
    [LGHttpTool GET:url parameters:nil
            success:^(id responseObject) {
                
                Discover_Mind_Model * mind = [Discover_Mind_Model mj_objectWithKeyValues:responseObject];
                Discover_Mind * data = mind.data;
                
                if (success) {
                    
                    success(data);
                }
                
                
            } failure:^(NSError *error) {
                if (failure) {
                    failure(error);
                }
            }];

}

+ (void)discoverRaidersDataWithPages:(int)pages Success:(void (^)( NSArray * data))success failure:(void (^)( NSError *error))failure
{
    NSString * url =Discover_Raiders_URL(pages);
    
    [LGHttpTool GET:url parameters:nil success:^(id responseObject) {
        
        Discover_Raiders_Model * raidersData =[Discover_Raiders_Model mj_objectWithKeyValues:responseObject];
        NSArray * raiders = raidersData.data;
        
        if (success) {
            
            success(raiders);
        }
        
    } failure:^(NSError *error) {
        if (failure) {
            failure(error);
        }
    }];
    
}

@end
